import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '@/views/Login'
import News from '@/views/News'
import List from '@/views/List'
import Home from '@/views/Home'
import Layout from '@/views/Layout'
import Profile from '@/views/Profile'
import Area from '@/views/Area'
import Rent from '@/views/Rent'
import Search from '@/views/Rent/search'
import Detail from '@/views/Detail'
import Collect from '@/views/Profile/components/collect'
import publishHouse from '@/views/Profile/components/publishHouse'
import Map from '@/views/Map'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    component: Login
  },
  {
    path: '/area',
    component: Area
  },
  {
    path: '/rent/add',
    component: Rent
  },
  {
    path: '/rent/search',
    component: Search
  },
  {
    path: '/detail/:id',
    component: Detail
  },
  {
    path: '/collect',
    component: Collect
  },
  {
    path: '/publish',
    component: publishHouse
  },
  {
    path: '/map',
    component: Map
  },
  {
    path: '/layout',
    component: Layout,
    redirect: '/layout/home',
    children: [
      {
        path: 'home',
        component: Home
      },
      {
        path: 'news',
        component: News
      },
      {
        path: 'list',
        component: List
      },
      {
        path: 'profile',
        component: Profile
      }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
